1. Field of the Invention
The present invention relates to an event processing apparatus and a method for an operating system. In particular, it relates to a task execution technology of an operating system in an embedded apparatus with an on-board Central Processing Unit (CPU).
2. Description of the Related Art
An embedded apparatus with an on-board CPU implements an operating system. The operating system executes a plurality of events that are generated from input devices or other functional units, as a task, by using the CPU. An event occurs independently of execution of application programs. Also, a task is a unit to be processed or transacted based on the viewpoint from the operating system (or users). Usually, tasks are executed sequentially based on an occurrence order of events.
The apparatus has event queues for accumulating these events temporarily. According to an event-driven type processing technology, these events are read out sequentially from the queue. This technology sequentially processes events. Thus, unless a whole event is completely processed, the following event will not be read out.
FIG. 1 is a functional configuration diagram of an event processing apparatus based on a related art.
According to FIG. 1, the apparatus 1 has an input device unit 11, a CPU unit 12, another functional unit 13 and an operating system (OS) 10. The operating system 10 functions by execution of programs in the CPU unit 12. The input device unit 11 generates the events corresponding to the operation of the user or the apparatus function. The events are output to the operating system 10.
The input device unit 11 has a plurality of input devices and/or communication devices. Events that are generated from the input device unit 11 have information of a device/operation type, an occurrence time (for example, a lapsed time (unit: ms) from when the apparatus starts), and/or operational data (for example, a keycode of a key switch, or a movement variable of a mouse).
According to FIG. 1, the operating system 10 has an event control module 101, a plurality of event queues 102, an event processing module 103, a task queue 104 and a task executing module 105. These functional modules are realized by the programs being executed by the CPU 12.
The event control module 101 inputs the events generated from the input device unit 11 into the event queue 102. The events are put into the event queues 102 and are brought into a waiting state of FIFO (First In First Out). Also, the event control module 101 pulls out each event from the event queues 102. The event is output to the event processing module 103.
The event processing module 103 converts the event received from the event control module 101 into a task based on an application. The task is input into the task queue 104. The task queue 104 accumulates the task temporarily (FIFO). The task outputted from the task queue 104 is executed by the task executing module 105 using the CPU 12.
According to the above mentioned event driven processing, when a mass of events occurs for a short time, a number of events are accumulated in the event queue 102. In such a case, till processing of all events accumulated already in the event queue 102 are finished, unexecuted events are placed in the waiting state. As a result, there has been a problem that an application response is slow.
To attempt to solve this problem, according to Japanese Patent Application Publication No. 2000-137621, a priority is attached to an individual event, and each event is inserted into one of the plural event queues 102 selected based on its priority. According to FIG. 1, a plurality of event queues are provided, and one of the events is taken out from the event queue 102 with a higher priority. For the accumulated events with the same priority, however, the events are taken out sequentially from the event queue 102 in a manner that one of the events which first entered the event queue 102 is first taken out from the event queue 102.
According to Japanese Patent Application Publication No. 2004-287755, the event control module 101 also gives a time stamp to the event when occurring. According to this technique, in the case of two events of the same type, when the time interval of their time stamps is shorter than a predetermined threshold value, the event control module 101 executes only one event and deletes the other event. Owing to this, the situation that many events stay in the event queue is prevented. For example, when a user of the apparatus operates the same key repeatedly many times, events based on these key operations can be deleted.
In recent years, the above mentioned OS is also installed in a terminal with lower computing capability like a cellular phone or a personal digital assistance. Because of miniaturization and high efficiency of device technology, a pointing device (a key switch, a mouse or a track-point or a track pad), a ten key, a full-keyboard, an acceleration sensor and a touch panel are also attached or connected to a small embedded apparatus as input devices. Furthermore, through short distance radio communication techniques such as infrared or Bluetooth (registered trademark), there are input devices which operate an application executed on a cellular phone. For example, there is a wireless mouse and a wireless remote controller with a built-in acceleration sensor. Because an event generated by such input devices is converted into a task and the task is executed, pointing operations or scrolling operation on a cellular phone can be executed like a personal computer.
However, the computing performance of a CPU built in a cellular phone is far lower than that of a CPU built in a personal computer. Therefore, depending on user operations for the cellular phone, there is a case that a large number of events occur serially from the input devices for a short time. In this case, it is necessary to execute these events effectively.
According to the technique described in Japanese Patent Application Publication No. 2000-137621, addition of priority information to each event increases an amount of information by the priority information. Also, the use efficiency of a memory becomes lower in order to satisfy the necessity of managing a plurality of event queues. Furthermore, in the case in which there are a plurality of event queues, the order in which events are input and the order in which the events are output may be different, and an attempt to keep actual event input/output orders to follow FIFO makes the use efficiency of a memory lower.
According to the technique described in Japanese Patent Application Publication No. 2004-287755, an event that should not be deleted may be mistakenly deleted, because it is determined whether the event should be deleted only based on the time interval of the time stamps.